package com.diyunapp.xilinapp.login;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.diyunapp.xilinapp.R;
import com.diyunapp.xilinapp.selfdefine.StatusBarFragmentActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ForPassFirActivity extends StatusBarFragmentActivity {

    @Bind(R.id.go_back)
    ImageView goBack;
    @Bind(R.id.lin_email)
    LinearLayout linEmail;
    @Bind(R.id.lin_phone)
    LinearLayout linPhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_for_pass_fir);
        ButterKnife.bind(this);
        View headView = findViewById(R.id.forfir_menubar_inc);
        super.MenuWidget(headView);
    }

    @OnClick({R.id.go_back, R.id.lin_email, R.id.lin_phone})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.go_back:
                finish();
                break;
            case R.id.lin_email:
                Intent setInt1 = new Intent(this, ForgetPasswordActivity.class);
                startActivityForResult(setInt1, 1);
                break;
            case R.id.lin_phone:
                Intent setInt2 = new Intent(this, ForPassPhoneActivity.class);
                startActivityForResult(setInt2, 1);
                break;
        }
    }


    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        //执行退出当前账户后，返回我的页面，并清空相关信息
        if (requestCode == 1 && resultCode == 1) {
            finish();
        }

        //用户登录成功后，退回我的页面，并查询更新账户信息
        if (requestCode == 2) {
            if (resultCode == 1) {
              finish();
            }
        }
        super.onActivityResult(requestCode, resultCode, data);
    }
}
